1. Which of the following is a key feature added in C++ but not available in C?
Correct Answer: (B) Classes
2. How is a function parameter passed by reference in C++?
Correct Answer: (A) By using & after the type
3. What is the default value in C++ used for?
Correct Answer: (C) To assign a default value to function parameters
4. What is the syntax for calling a function by reference in C++?
Correct Answer: (B) type& identifier
5. Which of the following is a new type introduced in C++ that extends the C struct?
Correct Answer: (B) Class
6. Which keyword is used in C++ to define public members of a class?
Correct Answer: (C) public
7. Which function is called automatically when an object of a class is created in C++?
Correct Answer: (C) Constructor
8. What is the purpose of a destructor in C++?
Correct Answer: (B) It deallocates memory
9. In C++, what is the symbol for the destructor function?
Correct Answer: (B) ~
10. Which of the following features distinguishes C++ from C?
Correct Answer: (B) Classes and Objects
11. What is the scope resolution operator in C++ used for?
Correct Answer: (B) To access class member functions outside the class.
12. Which of the following is true about function overloading in C++?
Correct Answer: (B) Functions with the same name must have different parameters.
13. What is the main advantage of using a constructor in C++?
Correct Answer: (A) It initializes class objects automatically.
14. What is the default access specifier for class members in C++?
Correct Answer: (B) private.
15. Which feature of C++ allows a function to behave differently based on the arguments passed?
Correct Answer: (A) Overloading.
16. Which C++ feature enables hiding the implementation details from the user?
Correct Answer: (A) Data abstraction.
17. Which of the following is an example of polymorphism in C++?
Correct Answer: (A) Function overloading.
18. What is the purpose of the inline keyword in C++?
Correct Answer: (A) To reduce the execution time of the program.
19. Which of the following represents a correct constructor declaration for a class named "Test"?
Correct Answer: (B) Test();
20. Which of the following is true for destructors in C++?
Correct Answer: (C) They are called automatically when an object is destroyed.
21. Which of the following is a feature of Object-oriented Programming (OOP)?
Correct Answer: (D) All of the above.
22. What is the term for combining data and functions that operate on the data in a single unit?
Correct Answer: (B) Encapsulation.
23. Which of the following is NOT a type of inheritance in C++?
Correct Answer: (D) Pointer inheritance.
24. In OOP, which of the following supports dynamic method resolution?
Correct Answer: (A) Polymorphism.
25. Which keyword is used to define an abstract class in C++?
Correct Answer: (B) virtual.
26. What is the relationship between base class and derived class in inheritance?
Correct Answer: (A) IS-A relationship.
27. Which of the following is used to prevent a class from being inherited?
Correct Answer: (A) Final keyword.
28. Which operator is used to access the members of a class in C++?
Correct Answer: (B) . (dot operator).
29. Which type of function can have different implementations depending on the object that calls it?
Correct Answer: (B) Virtual function.
30. A constructor is called when:
Correct Answer: (A) An object is created.
31. Which of the following statements about destructors is true?
Correct Answer: (B) Destructors cannot take arguments
32. In C++, what happens when a class inherits from another class with public access?
Correct Answer: (B) Public members of the base class remain public in the derived class
33. In multiple inheritance, if two base classes have a function with the same name, how can you resolve the ambiguity in the derived class?
Correct Answer: (A) Use scope resolution operator
34. Which concept allows functions to be defined with the same name but with different signatures in C++?
Correct Answer: (B) Overloading
35. What is the purpose of a copy constructor?
Correct Answer: (A) To initialize an object using another object of the same class
36. Which of the following is a valid declaration of a pure virtual function in C++?
Correct Answer: (B) virtual void show() = 0;
37. Which of the following C++ concepts provides the ability to define the same function in multiple derived classes and invoke the correct one based on the object type?
Correct Answer: (C) Polymorphism
38. Which of the following is NOT an access specifier in C++?
Correct Answer: (D) Friend
39. In C++, the keyword this refers to:
Correct Answer: (A) The current object
40. Which of the following is used to release memory allocated to an object in C++?
Correct Answer: (B) Destructor